import http from '@/util/http.js'

export default {
    indexData(start, count, searchContext) {
        return http.get("/post/getpost", {
            'start': start,
            'count': count,
            'searchContext': searchContext,

        })
    },
    postInfo(postId) {
        return http.get("/post/getpostbyid", {
            'postId': postId,
        })
    },
    getComment(node) {
        return http.get("/comment/getcommentbynode", {
            'node': node,
        })
    },
    login(email, password) {
        return http.post("/user/login", {
            'userEmail': email,
            'userPassword': password
        })
    },
    logout() {
        return http.post("/user/logout", {})
    },
    sendPost(post_title, editor, try_editor, tags) {
        return http.post("/post/sendpost",
            {
                'postTitle': post_title,
                'whatPostContent': {
                    postContent: editor + '<br/>' + try_editor
                },
                'whatTags': tags
            })
    },
    sendComment(parentId, value) {
        return http.post("/comment/sendcomment",
            {
                commentParent: parentId,
                commentContent: value
            })
    }


}